var app = new Vue({
    el:'#app',
    methods: {
        deleteRow(index, rows) {
            rows.splice(index, 1);
        },
        tableRowClassdeparture({row, rowIndex}) {
            if (rowIndex%2 === 0) {
                return 'warning-row';
            } else if (rowIndex%2 !== 0) {
                return 'success-row';
            }
            return '';
        },
        show(){
            var that = this
            // console.log(this.choice)
            axios({
                url:"http://localhost:8081/test/12",
                method:"post",
                data:{
                    depar:that.value1,
                    arriv:that.value2,
                    deparTime:that.departureTime
                }
            }).then(res=>{
                this.List = res.data
            }).catch(err=>{
                alert(err);
            })
            // alert(this.departureTime)
        }
    },
    data() {
        return {
            value1: '',
            value2: '',
            departureTime: '',
            choice:{
                depar:'',
                arriv:'',
                deparTime:''
            },
            tableData: [],
            List:[],
            options1: [{
                value: '选项1',
                label: '重庆'
            }, {
                value: '选项2',
                label: '四川',
            }, {
                value: '选项3',
                label: '北京'
            }, {
                value: '选项4',
                label: '上海'
            }],

            options2: [{
                value: '选项1',
                label: '重庆'
            }, {
                value: '选项2',
                label: '四川',
            }, {
                value: '选项3',
                label: '北京'
            }, {
                value: '选项4',
                label: '上海'
            }],
            pickerOptions: {

                shortcuts: [{
                    text: '今天',
                    onClick(picker) {
                        picker.$emit('pick', new Date());
                    }
                }, {
                    text: '明天',
                    onClick(picker) {
                        const date = new Date();
                        date.setTime(date.getTime() + 3600 * 1000 * 24);
                        picker.$emit('pick', date);
                    }
                }, {
                    text: '一周后',
                    onClick(picker) {
                        const date = new Date();
                        date.setTime(date.getTime() + 3600 * 1000 * 24 * 7);
                        picker.$emit('pick', date);
                    }
                }]
            }

        }
    }
})